TCGETPGRP
Section: Misc. Reference Manual Pages (3P)
Updated: August 1, 1992
Index
Return to Main Contents
NAME
tcgetpgrp, tcsetpgrp - get and set foreground process group ID
SYNOPSIS
#include <sys/types.h>
int tcgetpgrp(int fildes);
int tcsetpgrp(int fildes, pid_t pgrp_id);
DESCRIPTION
Tcgetpgrp returns the value of the process group ID of the
foreground process group associated with the terminal, indicated through
fildes. It may be
called from a process that is a member of a background process group;
however, the information may be changed by a process that is a member
of a foreground process group.
Tcsetpgrp sets the foreground process group ID associated with
the controlling terminal, indicated through fildes, to pgrp_id.
The controlling terminal must be currently associated with the session
of the calling process. The value of pgrp_id must match a process
group ID of a process in the same session as the calling process.
RETURN VALUE
Upon successful completion tcgetpgrp and tcsetpgrp
return a value of zero. Otherwise, a value of -1 is returned and
errno is set to indicate the error.
ERRORS
Tcgetpgrp
and
tcsetpgrp
shall return -1 and set
errno
to the corresponding value:
- [EBADF]
-
The
fildes
argument is not a valid file descriptor.
- [ENOTTY]
-
The calling process does not have a controlling terminal.
- [ENOTTY]
-
The file given through fildes is not the controlling terminal.
The following errors may be associated with tcsetpgrp:
- [EINVAL]
-
The value of the pgrp_id argument is not valid.
- [ENOTTY]
-
The controlling terminal is no longer associated with the session of
the calling process.
- [EPERM]
-
The value of pgrp_id is a valid value, but does not match the
process group ID of a process in the same session as the calling
process.
SEE ALSO
setsid(2P), setpgid(2P)
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- RETURN VALUE
-
- ERRORS
-
- SEE ALSO
-
This document was created by
man2html,
using the manual pages.
Time: 17:21:00 GMT, March 25, 2025